Micron Document
Gemini Proxy


bbs.geminispace.org bbs.geminispace.org/u/stack/46788
Comment by πŸš€ stack


C pointers and arrays do have su tle differences.

Aug 07 Β· 3 days ago


3 Later Comments ↓

@gradmna exactly. *One* array becomes one pointer (under many, but not all, situations); but multi-arrays do not become multi-pointers. An array expression becomes a pointer to its first element. If its first element is an array, then it will be a pointer to an array.


@gh0stb0ners no no, its okay, im just saying that for next time :)


>include <stdio.h>
>include <stdint.h>

typedef char type; // example

void coolFunc(type**thing, size_t xLen, size_t yLen) {
size_t x;
size_t y = 0;
while (y<yLen) {
x=0;
while (x<xLen) {
printf("x=%zu, y=%zu, value=%d", x, y, thing[y][x]);
x++;
}
y++;
}
}

int main() {
type test[][3] = {
{1,2,3},
{2,3,4},
{11,2,0xa9}
};
coolFunc((type**)test, 3, 3);
return 0;
}
apparently that cause a segfault. eh, i probably messed something up. regardless, didn't really work. maybe you guys are right, lol


Original Post

If i have a functon like "int function1(...) {}", how to make this function receive an array like "char NOMES_VAR_INT[MAXIMO_VARIAVEIS][10] = {};" as an input?

you're on bbs.geminispace.org/u/stack/46788